package w3

class Circle {
  private[this] var radius: Double = 0.0;
  private[this] var x: Double = 0.0;
  private[this] var y: Double = 0.0;

  def setR(r: Double) = {
    radius = r
  }

  def area() = {
    radius * radius * Circle.pi;
  }
}

object Circle {
  def main(args: Array[String]): Unit = {
    Circle.showPI()
    val b = Circle(100, 20, 30)
    println(b.area())
    //    val c = new Circle
    //    c.setR(123)
    //    println(c.area())
  }

  def apply(x: Double, a: Double, b: Double): Circle = {
    val c = new Circle
    c.setR(x)

    c
  }

  def showPI(): Unit = {
    println("圆周率是" + pi)
  }

  def pi = 3.1415926
}
